<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
body
{
	margin:0px;
	font-size:12px;
	font-family:Tahoma,Arial,"宋体";
	text-align:left;
	background-color:#ffffff;
	color:#336699;
}
input, select, textarea{ border:1px solid #999;}
.input{ width:300px;}
.file{ width:150px;}
input{margin-right:5px; margin-bottom:5px;}
img{ border:0;}
#messagebox_impeach{
  width:650px;
  height:auto;
  padding:8px 10px 8px 10px;
  float:left;
  position:absolute;
  z-index:1;
  background-color:#fff;
  }
 #messagebox_close{
 width:60px;
 height:atuo;
 float:right;
 color:#999;
 text-align:right;
} 
 #messagebox_close a{
 color:#999;
 text-decoration:underline;
 }
  #messagebox_close a:hover{
 color:#666;
 text-decoration:underline;
 }
 #messagebox_1_tit{
 width:620px;
 height:20px;
 margin-top:5px;
 padding:0;
 float:left;
 color:#0095BA;
 font-size:14px;
 line-height:20px;
}
.messagebox_1_text{
 width:620px;
 height:atuo;
 margin-top:5px;
 padding:0;
 float:left;
 color:#666;
}

.messagebox_1_space{
 width:620px;
 height:10;
 float:left;
 color:#666;
}
.redbuttom{padding:3px 2px 1px 2px; TEXT-ALIGN: center; BORDER-RIGHT: #6a6a6a 1px solid; BORDER-TOP: #fff 1px solid;BACKGROUND: #36BEFA; COLOR: #fff; BORDER-BOTTOM: #6a6a6a 1px solid; cursor:pointer;}
img{ border:1px #C4C4C4 solid;}
</style>
<title>title</title>
</head>
<script language="javascript">
var i = 1;//设置基数为2
function addFile(key)
{
	var dv = document.getElementById("dvFiles");//设置生成表单内容的容器，即放置位置
	var input = document.createElement("input");//建立input标记的内容
	input.type = "text";//设置类型
	input.style.width = 300;
	
	input.id = "input" + i;//设置id和名称
	input.name   =   "filename[]";  
	dv.appendChild(input);//在容器里添加
	
	var file = document.createElement("input");   
	if(key == 1)
	{
		file.type   =   "file";  
	}
	else
	{
		file.type   =   "text";  
	}
	file.id   =    "file"   +   i;   
	file.name   =   "uf_file[]";  
	dv.appendChild(file);   

	var btn = document.createElement("input");//建立input标记内容
	btn.type = "button";//类型
	btn.id = btn.name="btn"+i;//id和名称
	btn.value = "删除";//内容值
	btn.onclick = function()
	{//单击调用函数 
		var b = document.getElementById(btn.id);//获得相关内容
		var p = document.getElementById(input.id);

		dv.removeChild(p);

		dv.removeChild(b.nextSibling); //remove <BR>//删除
		dv.removeChild(b.previousSibling); //file
		dv.removeChild(b); //btn
	} 
	dv.appendChild(btn);
	dv.appendChild(document.createElement("BR")); //打印换行
	i++;
} 
function CheckForm()
{
	document.form1.submit();
}
function del_t(url)
{
 	if (confirm("您确定要删除吗？"))
	{
 		document.location.href = url;
 	}
}</script>
<body>
<div id="messagebox_impeach">

<div class="messagebox_1_text">
<?php if($parentid){?>
[<a href="<?php echo 'admin.php?action=file&uf_type='.$uf_type.'&uf_class='.$uf_class.'&infoid='.$infoid.'&parentid='.$parentid;?>"><?php echo $typename; ?>管理</a>]
<?php } ?>
第一个框为:介绍 , 第二个为:地址url</div>
  <div id="messagebox_close" type=button value="Close" onclick="self.parent.tb_remove();"><img src="../image/default/img_close.gif" />&nbsp;<a href="#">关闭</a></div>

<?php 
if($rs)
{
	foreach ($rs as $key => $rsValue)
	{
	?>
	<div class="messagebox_1_text">
	<?php echo $rsValue['fileid']; ?>
	<?php if($uf_class == 1){?>
	<a href="../<?php echo $rsValue['uf_file']; ?>" target="_blank"><img 
	src='../<?php echo $rsValue['uf_file']; ?>' width="120px" height="16px"></a>
	<?php }
		if($uf_class == 2){
		echo $rsValue['uf_file']; 
	 }?>
	 [<?php  echo $rsValue['uf_addtime'];?>] 
	<a href="admin.php?action=file&uf_type=<?php
	echo $uf_type.'&uf_class='.$uf_class.'&infoid='.$infoid.'&parentid='.$parentid.'&fileid='.$rsValue['fileid']; 
	?>"><img src="../image/default/3.gif"  /></a>
	
	<a href="javascript:del_t('admin.php?action=file&actiondel=del&uf_type=<?php 
	echo $uf_type.'&uf_class='.$uf_class.'&infoid='.$infoid.'&parentid='.$parentid.'&id='.$rsValue['fileid']; 
	?>');"><img src="../image/default/4.gif" /></a>

	介绍：<?php echo $rsValue['filename']; ?>
	</div>
	<?php 
	}
}
?>
<form id="form1" name="form1" method="post" action="" enctype="multipart/form-data">
	<?php if($fileid){?>
		<input name="actionPost" type="hidden"  value="update" />
		<input name="uf_fileold" type="hidden"  value="<?php echo $rsOne['uf_file']; ?>" />
		<div id="dvFiles">
		<div class="messagebox_1_text">
		<?php if($uf_class == 1){?>
		<a href="../<?php  echo $rsOne['uf_file']; ?>" 
		target="_blank">
		<img src="" id="face1" width="120" height="30px" /></a>
		<script language="javascript">
		document.getElementById("face1").src="../<?php  echo $rsOne['uf_file']; ?>"+"?temp="+ Date.parse(new Date()); 
		</script>
		<?php }?>
		<input name="filename[]" class="input" type="text"  value="<?php echo $rsOne['filename']; ?>" />
		<?php if($uf_class == 1){?>
		<input type="file" class="file" name="uf_file[]" id="file" /> 
		<?php }else{?>
		<input type="text" class="file" name="uf_file[]" value="<?php echo $rsOne['uf_file']; ?>" />
		<?php }?>			
		</div>
		</div>
	<?php }else{?>
		<input name="actionPost" type="hidden"  value="add" />
		<div id="dvFiles">
		<div class="messagebox_1_text">
		<input name="filename[]" class="input" type="text" value="" />
		<?php if($uf_class == 1){?>
		<input type="file" class="file" name="uf_file[]" id="file" /> 
		<?php }else{?>
		<input type="text" class="file" name="uf_file[]" />
		<?php }?>			
		</div>
		</div>
		<div class="messagebox_1_text" style="float:right">
		<a href="javascript:addFile(<?php echo $uf_class; ?>);">继续添加<?php echo $typename; ?></a>
		</div>
	<?php }?>
  <div class="messagebox_1_text">
    <input name="" class="redbuttom"
	 type="submit" onclick="javascript:return CheckForm();" value="提交<?php echo $typename; ?>" />
	<input name="" class="redbuttom"
	 type="button" onclick="javascript:self.parent.tb_remove();" value="关闭" />
  </div>
</form>
</div>
</body>
</html>